
// 手机号码的验证
const regPhone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
export const regPhoneTest = (str:string):boolean => {
    return regPhone.test(str)
}

const regType111 = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|x|X)$/
const regType553 = /^[A-Z]{3}\d{12}$/
export const regTypeCodeTest = (type:string, code:string):boolean => {
    if(type == '111') {
        return regType111.test(code)
    }else if(type == '553') {
        return regType553.test(code)
    }else {
        return true  
    }
}

export const submitForm = async(form, arr) => {
    const status = []
    await Promise.all(
        arr.map(item => form.value.validate(item).then(() => {
            // status.push(true)
        })
            .catch(() => {
                status.push(false)
            }))
    )
    return status
}